<Project>
  <PropertyGroup>
    <AssemblyName>crossgen2</AssemblyName>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <OutputType>Exe</OutputType>
    <NoWarn>8002,NU1701</NoWarn>
    <Platforms>x64;x86;arm64;arm;loongarch64;riscv64</Platforms>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
    <AppendTargetFrameworkToOutputPath Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</AppendTargetFrameworkToOutputPath>
    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
    <EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
    <Configurations>Debug;Release;Checked</Configurations>
    <RunAnalyzers>false</RunAnalyzers>
  </PropertyGroup>

  <Import Project="../AotCompilerCommon.props" />

  <ItemGroup Label="Embedded Resources">
    <EmbeddedResource Include="Properties\Resources.resx">
      <GenerateSource>true</GenerateSource>
      <ClassName>System.SR</ClassName>
    </EmbeddedResource>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="System.CommandLine" Version="$(SystemCommandLineVersion)" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\ILCompiler.DependencyAnalysisFramework\ILCompiler.DependencyAnalysisFramework.csproj" />
    <ProjectReference Include="..\ILCompiler.TypeSystem\ILCompiler.TypeSystem.csproj" />
    <ProjectReference Include="..\ILCompiler.ReadyToRun\ILCompiler.ReadyToRun.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Compile Include="..\..\Common\CommandLineHelpers.cs" Link="CommandLineHelpers.cs" />
    <Compile Include="..\..\Common\InstructionSetHelpers.cs" Link="InstructionSetHelpers.cs" />
  </ItemGroup>

  <PropertyGroup>
    <TargetArchitectureForSharedLibraries Condition="'$(CrossHostArch)' == ''">$(TargetArchitecture)</TargetArchitectureForSharedLibraries>
    <TargetArchitectureForSharedLibraries Condition="'$(CrossHostArch)' != ''">$(CrossHostArch)</TargetArchitectureForSharedLibraries>
    <TargetArchitectureForSharedLibraries Condition="'$(TargetArchitectureForSharedLibraries)'=='armel'">arm</TargetArchitectureForSharedLibraries>

    <JitInterfaceLibraryName>$(LibPrefix)jitinterface_$(TargetArchitectureForSharedLibraries)$(LibSuffix)</JitInterfaceLibraryName>
  </PropertyGroup>

  <ItemGroup>
    <Content Include="$(CoreCLRArtifactsPath)/$(CrossHostArch)/$(JitInterfaceLibraryName)"
      CopyToOutputDirectory="PreserveNewest"
      CopyToPublishDirectory="PreserveNewest"
      Link="%(FileName)%(Extension)"
      />

    <Content Include="$(CoreCLRArtifactsPath)/$(CrossHostArch)/$(LibPrefix)clrjit_*_$(TargetArchitectureForSharedLibraries)$(LibSuffix)"
      CopyToOutputDirectory="PreserveNewest"
      CopyToPublishDirectory="PreserveNewest"
      Link="%(FileName)%(Extension)"
      />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetOS)' == 'windows'">
    <Content Include="$(RuntimeBinDir)/pgort*.dll"
      CopyToOutputDirectory="PreserveNewest"
      CopyToPublishDirectory="PreserveNewest"
      Link="%(FileName)%(Extension)"
      Condition="'$(PgoInstrument)' != ''"
      />

    <PackageReference Include="Microsoft.DiaSymReader.Native"
      Version="$(MicrosoftDiaSymReaderNativeVersion)"
      IsImplicitlyDefined="true"
      ExcludeAssets="all"
      GeneratePathProperty="true"
      />
  </ItemGroup>

  <PropertyGroup Condition="'$(TargetOS)' == 'windows'">
    <DiaSymReaderTargetArch>$(TargetArchitectureForSharedLibraries)</DiaSymReaderTargetArch>
    <DiaSymReaderTargetArch Condition="'$(DiaSymReaderTargetArch)' == 'x64'">amd64</DiaSymReaderTargetArch>
    <DiaSymReaderTargetArchFileName>Microsoft.DiaSymReader.Native.$(DiaSymReaderTargetArch).dll</DiaSymReaderTargetArchFileName>
    <DiaSymReaderTargetArchPath Condition="'$(PkgMicrosoft_DiaSymReader_Native)' != ''">$(PkgMicrosoft_DiaSymReader_Native)\runtimes\win\native\$(DiaSymReaderTargetArchFileName)</DiaSymReaderTargetArchPath>
    <!-- When publishing we won't have the NuGet packages, so use the copy from the build artifacts directory. -->
    <DiaSymReaderTargetArchPath Condition="'$(PkgMicrosoft_DiaSymReader_Native)' == ''">$(CoreCLRArtifactsPath)crossgen2/$(DiaSymReaderTargetArchFileName)</DiaSymReaderTargetArchPath>
  </PropertyGroup>

  <ItemGroup Condition="'$(TargetOS)' == 'windows'">
    <Content Include="$(DiaSymReaderTargetArchPath)"
      CopyToOutputDirectory="PreserveNewest"
      CopyToPublishDirectory="PreserveNewest"
      Link="%(FileName)%(Extension)"
      />
  </ItemGroup>
</Project>
